package com.wn.controller;

import com.wn.entity.Manager;
import com.wn.entity.ResponseEntity;
import com.wn.service.ManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/rbac_manager")
public class ManagerController {
    @Autowired
    ManagerService managerService;

    @RequestMapping("addOne")
    public ResponseEntity addOne(@RequestBody Manager manager) {
        managerService.addOne(manager);
        return com.wn.entity.ResponseEntity.SUCCESS;
    }

    @RequestMapping("deleteOne")
    public ResponseEntity deleteOne(@RequestBody Manager manager) {
        managerService.deleteOne(manager);
        return com.wn.entity.ResponseEntity.SUCCESS;
    }

    @RequestMapping("update")
    public ResponseEntity update(@RequestBody Manager manager) {
        managerService.update(manager);
        return com.wn.entity.ResponseEntity.SUCCESS;
    }

    @RequestMapping("findAll")
    public ResponseEntity findAll() {
        List<Manager> managers = managerService.findAll();
        return new ResponseEntity(200, "成功", managers);
    }
}


